﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using shared_libs;
using chatc_application.frame;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;

namespace chatc_application.connect
{
    
    class MessageReciever : MarshalByRefObject, IMessageReciever

    {
       private ClientChat clientGui;
       private String username;

       public MessageReciever(ClientChat client, String username) {
           
          clientGui = client;
          this.username = username;
          //TcpChannel chan = new TcpChannel(0);
          //ChannelServices.RegisterChannel(chan, false);
       }

        public void receiveMessage(String fromUser, String text)
        {
            String textForRec = fromUser + ": " + text + "\r\n";
            clientGui.TextSend(textForRec);
           // clientGui.textBoxRceiving.Text = "ganch";
             
        }
        public string getUsername()
        {
            return username;
        }
    }
}
